#ifndef FileManager_H
#define FileManager_H

#include<Ice/Ice.h>
#include <Yafridng.h>

using namespace std;
using namespace Yafridng;

class File_nextI
: public AMI_File_next,
  public IceUtil::Monitor<IceUtil::Mutex>
{
public:
  
  File_nextI() :
    _done(false)
  {
  }
  virtual void ice_response(const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&);
  virtual void ice_exception(const ::Ice::Exception&);
  void getData(::Ice::ByteSeq&);
 
private:

  bool _done;
  auto_ptr<Ice::Exception> _exception;
  Ice::ByteSeq _bytes;  
};

typedef IceUtil::Handle<File_nextI> File_nextIPtr;

class FileManager 
{
 public:
 FileManager(std::string scene, 
	     FilePrx file,
	     string flags): 
  _scene(scene),
    _file(file),
    _flags(flags),
    _offset(0)
      {
      }
  
 FileManager(std::string scene,
	     FilePrx file,
	     string flags,
	     int offset):
  _scene(scene),
    _file(file),
    _flags(flags),
    _offset(offset)
    {
    }
  
  int getFile();
  string getFileName();
  
 private:
  std::string _scene;
  std::string _flags;
  int _offset;
  Yafridng::FilePrx _file;
};
#endif
